package pers.course.week3;

import java.util.Scanner;

public class UniqueDigits {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int nums = in.nextInt();
        for (int i = 0; i < nums; i++) {
            String num = in.next();
            char[] arr = num.toCharArray();
            int j = 0;
            if(arr[0] == '-') j = 1;
            here: for(; j < arr.length; j++)
            {
                for(int m = 0; m < j; m++) {
                    if (arr[m] == arr[j]) {
                        continue here;
                    }
                }
                System.out.print(arr[j]);
            }
            System.out.print("\n");
        }
        in.close();
    }
}
